<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" th:replace="layout-admin">
<head>
    <meta charset="UTF-8">


    <th:block th:fragment="header">
        <style>
        </style>
    </th:block>

</head>
<body>

<div class="container-md" id="container" th:fragment="content">
    <div id="app" class="card">

        <div class="card-header">
            <h3 class="card-title"> 个人信息 </h3>
        </div>
        <div class="card-body">
            <div>
                用户名： <label>{{me.name}}</label>
                新密码： <input type="password" v-model="me.newPassword">
                <button type="submit" @click="submit()">保存</button>
            </div>


        </div>



    </div>


</div>

<th:block th:fragment="footer">


    <script type="module">

  const { createApp } = Vue;
  window.Vue=Vue;
    var app = createApp({
    data() {
      return { 
        me:{}
      }
    },methods:{
        submit:function (){
            var url = "/sys/user/me/update";
            axios.post(url, this.me).then(function (response) {
                console.log("response",response)
                loadData();
            }).catch(function (error) {
                console.log("error",error);
                loadData();
            });
        }
     }
  }).mount('#app');
function loadData( ){
    axios.post('/sys/user/me', {}).then(function (response) {
        console.log("me",response)
        app.$data.me = response.data.data;
    }).catch(function (error) {
        console.log("error",error);
    });
}

window.onload=function(){
   loadData( );
}






    </script>
</th:block>
</body>
</html>